import httpInstance from "@/utils/http.js";

// 获取商品列表
export function getGoodsListAPI(params) {
    return httpInstance({
        url: '/admin/goods/list',
        method: 'GET',
        params
    });
}

// 审核通过商品
export function approveGoodsAPI(gid, opinion) {
    return httpInstance({
        url: '/admin/goods/approve',
        method: 'POST',
        data: {
            gid,
            opinion
        }
    });
}

// 拒绝商品
export function rejectGoodsAPI(gid, opinion) {
    return httpInstance({
        url: '/admin/goods/reject',
        method: 'POST',
        data: {
            gid,
            opinion
        }
    });
}

// 下架商品
export function offlineGoodsAPI(gid, opinion) {
    return httpInstance({
        url: '/admin/goods/offline',
        method: 'POST',
        data: {
            gid,
            opinion
        }
    });
}

// 上架商品
export function onlineGoodsAPI(gid, opinion) {
    return httpInstance({
        url: '/admin/goods/online',
        method: 'POST',
        data: {
            gid,
            opinion
        }
    });
}

// 获取商品详情
export function getGoodsDetailAPI(gid) {
    return httpInstance({
        url: `/admin/goods/${gid}`,
        method: 'GET'
        }
    );
}

// 删除商品
export function deleteGoodsAPI(gid, opinion) {
    return httpInstance({
        url: '/admin/goods/delete',
        method: 'POST',
        data: {
            gid,
            opinion
        }
    });
}